/**
 * Copyright (c) 2009-2012 XTEAM
 * All rights reserved.
 */
/**
 * File：FrontAdvertiseService.java
 * History:
 *         2012-7-25: Initially created, Chrise.
 */
package com.xteam.ecsystem.service.front;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xteam.ecsystem.base.NormalPage;
import com.xteam.ecsystem.base.NormalState;
import com.xteam.ecsystem.dao.IAdvCfgDao;
import com.xteam.ecsystem.entities.SysAdvConfig;

/**
 * 广告服务层。
 * @author Chrise
 */
@Service
public class FrontAdvertiseService {
	
	@Autowired
	private IAdvCfgDao acDao;
	
	/**
	 * 获取广告列表。
	 * @author Chrise 2012-7-25
	 * @param page
	 * @param position
	 * @return
	 */
	public List<SysAdvConfig> getAdvertises(Integer page, Integer position) {
		if (page == null) page = IAdvCfgDao.INVALID_PAGE;
		if (position == null) position = IAdvCfgDao.INVALID_POSITION;
		
		List<SysAdvConfig> list = this.acDao.getAdvertises(NormalPage.COMMON.value(), 
			page, position, NormalState.EFFECTIVE.value());
		if (list == null) {
			list = new ArrayList<SysAdvConfig>();
		}
		
		return list;
	}
}
